<%-- 
    Document   : phoneViewDetail
    Created on : 2017-1-7, 16:30:50
    Author     : 52461
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=0.8,user-scalable=no">
        <title>会诊申请单</title>
        <link href="${base}/css/paper_edit.css" rel="stylesheet">
        <link href="${base}/css/font-awesome.css" rel="stylesheet">
        <link href="${base}/css/nprogress.css" rel="stylesheet">
        <!--<link href="${base}/css/material-kit.css" rel="stylesheet">-->
        <link href="${base}/css/bootstrap-material-datetimepicker.css" rel="stylesheet">
        <script type="text/javascript" src="${base}/js/jquery-1.9.1.js"></script>
        <script type="text/javascript" src="${base}/js/jquery-ui-1.10.3.custom.min.js"></script>
        <script type="text/javascript" src="${base}/js/jquery.datetimepicker.full.min.js"></script>
        <script type="text/javascript" src="${base}/js/angular/angular.min.js"></script>
        <script type="text/javascript" src="${base}/js/moment-with-locales.min.js"></script>
        <script type="text/javascript" src="${base}/js/bootstrap-material-datetimepicker.js"></script>
        <script type="text/javascript" src="${base}/js/nprogress.js"></script>
        <script type="text/javascript" src="${base}/js/jquery.cxhd.js"></script>
        <script type="text/javascript" src="${base}/js/bootstrap.min.js"></script>
        <script type="text/javascript" src="${base}/js/angular-base.js"></script>
        <script type="text/javascript" src="${base}/js/nprogress.js"></script>

    </head>
    <body ng-app="pvd" ng-controller="mainCtrl" >
        <div style="position: fixed;top: 0;left: 0;height: 50px;width: 100%">

            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="container">
                        <center style="font-size: 16px;font-weight: bold;" >会诊申请单</center>
                    </div>
                </div>
            </div>

        </div>
        <div class="container" style="margin-top: 60px;">
            <table class="table table-striped table-bordered">
                <tr>
                    <th style="width: 90px;">申请医院:</th>
                    <td ng-bind="askInfo.hospital_name" ></td>
                </tr>
                <tr>
                    <th >病人姓名:</th>
                    <td ng-bind="askInfo.patient_name" ></td>
                </tr>
                <tr>
                    <th >病人性别:</th>
                    <td ng-bind="askInfo.sex" ></td>
                </tr>
                <tr>
                    <th >病人年龄:</th>
                    <td ng-bind="askInfo.age" ></td>
                </tr>
                <!--                <tr>
                                    <th>病人信息:</th>
                                    <td>
                                        <span>名字:</span><span ng-bind="askInfo.patient_name"></span>
                                        &nbsp;&nbsp;&nbsp;
                                        <span>性别:</span><span ng-bind="askInfo.sex"></span>
                                        &nbsp;&nbsp;&nbsp;
                                        <span>年龄:</span><span ng-bind="askInfo.sex"></span>
                                    </td>
                                </tr>-->
                <tr>
                    <th>申请人:</th>
                    <td ng-bind="askInfo.sender_name"></td>
                </tr>

                <tr>
                    <th>联系电话:</th>
                    <td ng-bind="askInfo.send_phone"></td>
                </tr>
                <tr>
                    <th>申请科室:</th>
                    <td ng-bind="askInfo.apply_department"></td>
                </tr>
                <tr>
                    <th>预约医生:</th>
                    <td><input readonly="readonly"  ng-focus ="openDoc()" id="doctor" ng-model="askInofo.recvicer_name" type="text"  ></td>
                </tr>
                <tr>
                    <th>医生电话:</th>
                    <td > <input  id="doctor_phone" ng-model="askInofo.recvicer_phone" type="text"  ></td>
                </tr>
                <tr>
                    <th>预约时间:</th>
                    <td> <input id="date-format" ng-model="askInfo.appointment_time" type="text"  ></td>
                </tr>
                <tr>
                    <th>会诊目的:</th>
                    <td ng-bind="askInfo.description"> </td>
                </tr>
            </table>
            <button ng-click="saveDetail()" class="btn btn-block btn-success">保存</button>
        </div>



        <div class="modal fade mode-doctor " role="dialog" aria-labelledby="gridSystemModalLabel">
            <div class="modal-dialog  modal-lg " role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        医生列表

                    </div>
                    <div class="modal-body" style="height: 300px;overflow-y: auto">

                        <table style="width: 100%" class="table">
                            <tr>
                                <th style="">序号</th>
                                <th>名字</th>
                                <th>性别</th>
                                <!--                                <th>年龄</th>-->
                                <th>科室</th>

                            </tr>
                            <tr   ng-repeat="item in ds">
                                <td  ng-click="selectDoctor(item, $event)" ng-bind="$index"></td>
                                <td ng-click="selectDoctor(item, $event)" ng-bind="item.ch_name"></td>
                                <td ng-click="selectDoctor(item, $event)" ng-bind="item.gender"></td>
                                <td ng-click="selectDoctor(item, $event)" ng-bind="item.department_name"></td>

                            </tr>




                        </table>                                    


                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">关闭</button>
                        <!--<button  data-dismiss="modal" type="button" class="btn btn-primary btn-sm"><span class="fa fa-save"></span>&nbsp;&nbsp;确定</button>-->
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
        </div><!-- /.modal -->
    </body>
</html>
<script>

    angular.module("pvd", ['baseModule'])
            .controller("mainCtrl", function ($scope, base) {
                $scope.askInfo = JSON.parse('<%=request.getAttribute("askInfo")%>');
                $scope.askInfo.contact_id = '<%=request.getAttribute("contact_id")%>';
                $('#date-format').bootstrapMaterialDatePicker({format: 'YYYY-MM-DD HH:mm'});
                $scope.getDoctor = function () {

                    base.post("getDoctor").get(function (data) {
                        $scope.ds = data.data;
                    })

                }
                $scope.saveDetail = function () {
                    base.post("updateAskDetail", $scope.askInfo).get(function (data) {
                        if (data == 'true') {
                            steveAl("保存成功", 1000);
                        } else {
                            steveAl(data, 1000);
                        }
                    })
                }
                $scope.openDoc = function () {
                    $(".mode-doctor").modal('show');
                    $scope.getDoctor();
                }
                $scope.selectDoctor = function (item, event) {
                    //$th = event.target;
                    $(event.target).parent().siblings().removeClass("bg-success");
                    $(event.target).parent().addClass("bg-success");
                    $(event.target).removeClass("bg-success");
                    $scope.askInfo.recvicer_id = item.username;
                    $scope.askInfo.recvicer_name = item.ch_name;
                    $scope.askInfo.recvicer_phone = item.phone;
                    $("#doctor").val(item.ch_name);
                    $("#doctor_phone").val(item.phone);

                }

            })

</script>
